package com.google.gwt.maps.v3.client.streetview;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.maps.v3.client.ControlPosition;
import com.google.gwt.maps.v3.client.streetview.impl.StreetViewAddressControlOptionsImpl;

public class StreetViewAddressControlOptions implements
    HasStreetViewAddressControlOptions {
  
  protected final JavaScriptObject jso;
  
  public StreetViewAddressControlOptions(final JavaScriptObject jso) {
    this.jso = jso;
  }
  
  public StreetViewAddressControlOptions() {
    this(StreetViewAddressControlOptionsImpl.impl.construct());
  }

  @Override
  public ControlPosition getPosition() {
    String position = StreetViewAddressControlOptionsImpl.impl.getPosition(jso);
    return ControlPosition.valueOf(position);
  }

  @Override
  public JSONObject getStyle() {
    JavaScriptObject style = StreetViewAddressControlOptionsImpl.impl.getStyle(jso);
    return new JSONObject(style);
  }

  @Override
  public void setPosition(ControlPosition position) {
    StreetViewAddressControlOptionsImpl.impl.setPosition(jso, position.toString());
  }

  @Override
  public void setStyle(JSONObject style) {
    StreetViewAddressControlOptionsImpl.impl.setStyle(jso, style.getJavaScriptObject());
  }

  @Override
  public JavaScriptObject getJso() {
    return jso;
  }

}
